Spread Windows Forms 6.0 Product Documentation
CopyTo(NamedStyle[],Int32) Method
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > NamedStyleCollection Class > CopyTo Method : CopyTo(NamedStyle[],Int32) Method


namedStyles
One-dimensional array into which are copied the elements from ICollection (The array must have zero-based indexing.)
index
Zero-based index in array at which to paste styles.

Glossary Item Box

Copies the styles in the collection to a specified array at a specified position.

Syntax

Visual Basic (Declaration) 
Public Overloads Overridable Sub CopyTo( _
   ByVal namedStyles() As NamedStyle, _
   ByVal index As Integer _
) 
Visual Basic (Usage)Copy Code
Dim instance As NamedStyleCollection
Dim namedStyles() As NamedStyle
Dim index As Integer
 
instance.CopyTo(namedStyles, index)
C# 
public virtual void CopyTo( 
   NamedStyle[] namedStyles,
   int index
)

Parameters

namedStyles
One-dimensional array into which are copied the elements from ICollection (The array must have zero-based indexing.)
index
Zero-based index in array at which to paste styles.

Example

This example copies the named styles in the collection to an array.
C#Copy Code
FarPoint.Win.Spread.NamedStyleCollection nsc = new FarPoint.Win.Spread.NamedStyleCollection();
FarPoint.Win.Spread.NamedStyle ns1 = new FarPoint.Win.Spread.NamedStyle("StyleHeaders", "HeaderDefault");
FarPoint.Win.Spread.NamedStyle ns2 = new FarPoint.Win.Spread.NamedStyle("StyleData", "DataAreaDefault");
ns1.BackColor = Color.LightBlue;
ns2.BackColor = Color.Gray;
nsc.AddRange(new Object[] {ns1, ns2});
fpSpread1.NamedStyles = nsc;
fpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = nsc[0];
fpSpread1.ActiveSheet.DefaultStyle = nsc[1];
FarPoint.Win.Spread.NamedStyle[] array = new FarPoint.Win.Spread.NamedStyle[nsc.Count];
nsc.CopyTo(array, 0);
label1.Text = "The name of the first style in the collection " + array.GetValue(0).ToString(); 
Visual BasicCopy Code
Dim nsc As New FarPoint.Win.Spread.NamedStyleCollection()
Dim ns1 As New FarPoint.Win.Spread.NamedStyle("StyleHeaders", "HeaderDefault")
Dim ns2 As New FarPoint.Win.Spread.NamedStyle("StyleData", "DataAreaDefault")
ns1.BackColor = Color.LightBlue
ns2.BackColor = Color.Gray
nsc.AddRange(New Object() {ns1, ns2})
FpSpread1.NamedStyles = nsc
FpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = nsc(0)
FpSpread1.ActiveSheet.DefaultStyle = nsc(1)
Dim array(nsc.Count) As FarPoint.Win.Spread.NamedStyle
nsc.CopyTo(array, 0)
Label1.Text = "The name of the first style in the collection " & array.GetValue(0).ToString()

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.